// module.exports = function(mainApp) {
var mainApp = angular.module("mainApp");
mainApp.filter("sceUrl", ["$sce", function($sce) {
    return function(url) {
        return $sce.trustAsResourceUrl(url);
    };
}]);

mainApp.filter("formatDate", ["$sce", function($sce) {
    return function(date) {
        return date.substring(0, 10);
    };
}]);

mainApp.filter("publicationDate", ["$sce", function($sce) {
    return function(date) {
        if (date) {
            var s_date = date.substring(0, 4);
            var e_date = date.substring(4, 6);
            var format_date = s_date + "/" + e_date;
            return format_date;
        };
        return "";
    };
}]);

mainApp.filter("idCard", [function() {
    return function(param) {
        var result = "";
        if (param) {
            param = "" +param;
            result = param.substring(0,6) + "****" +param.substring(param.length-4,param.length);
        }else{
            result = param;
        }
        return result;
    }
}]);
mainApp.filter("formatDay",[function(){
    var result = function(date){
        if (date) {
            var date = new Date(date);
            var handle_date = date.getFullYear() + '-' + (date.getMonth()+1) + '-' +date.getDay();
            return handle_date;
        }else{
            return '';
        }
    };
    return result;
}]);
mainApp.filter("addPercentage", [function() {
    return function(param) {
        var result = "";
        if (param ||param==0) {
            result = param +"%";
        }
        return result;
    }
}]);
// };
